home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / patch / turbocalc401.lha / Update / UpdateTurboCalc < prev   
Text File  |  1997-01-28  |  16KB  |  458 lines

  1.  
  2. ; ---------------------------------------------------------------------
  3. ;
  4. ; $VER: Update Installer Script 1.01 (20.01.97)
  5. ;
  6. ; Script to update TurboCalc (German, English, Italian, French version)
  7. ;
  8. ; © 1996 by Michael Friedrich
  9. ;
  10. ; ---------------------------------------------------------------------
  11. (set APPNAME "TurboCalc")
  12. (set OLDVERSION "4.00")
  13. (set NEWVERSION "4.01")
  14.  
  15. (if (<> @app-name "Test App")
  16.     (set APPNAME @app-name)
  17.     (set @app-name APPNAME)
  18. )
  19.  
  20. (set #DiskVersion 0)
  21. (set #updateprg "TurboCalcCD:Tools/Update")
  22. (set #updateprg_disk "TurboCalc4_Disk1:Tools/Update")
  23.  
  24. (if (<> @language "english")
  25.  ((if ( AND (<> @language "deutsch")
  26.             (AND (<> @language "français") (<> @language "italiano"))
  27.       )
  28.     (set @language "english")
  29.   )
  30.  )
  31. )
  32.  
  33.  
  34. ; ---------------------------------------------------------------------
  35. ;
  36. ;   STRINGS (German)
  37. ;
  38. ; ---------------------------------------------------------------------
  39. (if (= @language "deutsch")
  40.  (
  41.   (set #SourceDir "TurboCalcCD:Deutsch/TurboCalc")
  42.   (set #SourceDir_Disk "TurboCalc4_Disk1:TurboCalc")
  43.   (set #UpdateDir "Deutsch")
  44.   (set #HelpDir "Hilfe")
  45.   (set #HelpDirOS2 "Hilfe_OS2")
  46.  
  47.   (set #welcome
  48.    (cat "Dieses Skript aktualisiert das Programm " APPNAME
  49.         " von der Version " OLDVERSION " auf die Version " NEWVERSION ".\n\n"
  50.   ))
  51.   (set #hello
  52.    (cat "Dieses Skript aktualisiert das Programm " APPNAME
  53.         " von der Version " OLDVERSION " auf die Version " NEWVERSION ".\n\n"
  54.         "Es wird dabei die installierte Version auf der Festplatte geändert; "
  55.         "die Originaldateien werden von CD/Diskette gelesen, "
  56.         "um sicherzustellen, daß es sich um Dateien der Version " OLDVERSION " handelt." )
  57.   )
  58.  
  59.   (set #AskDestFile
  60.    (cat "Bitte bestimmen Sie den Pfad (und ggf. den Dateinamen) Ihrer alten "
  61.         APPNAME "-Version.\n" )
  62.   )
  63.  
  64.   (set #AskDestFileHelp
  65.    (cat "Wechseln Sie in das Verzeichnis, in dem Sie " APPNAME " installiert haben.\n"
  66.         "Der Dateiname muß normalerweise nicht verändert werden.\n" )
  67.   )
  68.  
  69.   (set #updating (cat "Aktualisiere %s ...\n\n"
  70.         "Dies kann einige Zeit dauern,\n"
  71.         "haben Sie bitte etwas Geduld.\n" ))
  72.  
  73.   (set #ErrorUpdateMissing (cat "Das Programm zum Aktualisieren der "
  74.         "Dateien (%s) ist leider nicht vorhanden. Legen Sie bitte die "
  75.         "Original TurboCalc4-CD (TurboCalcCD:) oder Diskette 1 "
  76.          "(TurboCalc4_Disk1:) ein und klicken Sie auf 'Weiter'!" ))
  77.  
  78.   (set #ErrorPrgFileMissing (cat "Der Pfad, in dem " APPNAME " aktualisiert "
  79.         "werden soll, scheint nicht korrekt zu sein (%s). "
  80.         "Das Hauptprogramm '%s' konnte an dieser Stelle nicht gefunden werden. "
  81.         "Bitte suchen Sie im folgenden Dateirequester " APPNAME " und "
  82.         "wählen Sie diese Datei aus." ))
  83.  
  84.   (set #ErrorMsg (cat "Beim Aktualisieren trat folgender Fehler auf:\n%s\n"
  85.             "Die Datei wurde nicht modifiziert!\n "))
  86.  
  87.   (set #Err1 "Kann Alte-Datei nicht öffnen." )
  88.   (set #Err2 "Kann Dif-Datei nicht öffnen." )
  89.   (set #Err3 "Kann Neue-Datei nicht öffnen." )
  90.   (set #Err4 "Falsche Alte-Datei (falsche Länge), UPDATE nicht möglich!" )
  91.   (set #Err5 "Falsche Alte-Datei (CRC falsch), UPDATE nicht möglich!" )
  92.   (set #Err6 "Falsche Alte-Datei (VER falsch), UPDATE nicht möglich!" )
  93.   (set #Err7 "Falsche Dif-Datei-Version, UPDATE mit dieser Version nicht möglich!" )
  94.   (set #Err8 "Nicht genügend Speicher!" )
  95.   (set #Err9 "Unbekannter Fehler: 9" )
  96.   (set #Err10 "Konnte das Programm UPDATE nicht finden!\n")
  97.   (set #ErrUnkown "Unbekannter Fehler: %s" )
  98.  
  99.  )
  100. )
  101. ; ---------------------------------------------------------------------
  102. ;
  103. ;   STRINGS (English)
  104. ;
  105. ; ---------------------------------------------------------------------
  106. (if (= @language "english")
  107.  (
  108.   (set #SourceDir "TurboCalcCD:English/TurboCalc")
  109.   (set #SourceDir_Disk "TurboCalc4_Disk1:TurboCalc")
  110.   (set #UpdateDir "English")
  111.   (set #HelpDir "Help")
  112.   (set #HelpDirOS2 "Help_OS2")
  113.  
  114.   (set #welcome
  115.    (cat "This scripts updates the program " APPNAME
  116.         " from version " OLDVERSION " to the new version " NEWVERSION ".\n\n"
  117.   ))
  118.   (set #hello
  119.    (cat "This scripts updates the program " APPNAME
  120.         " from version " OLDVERSION " to the new version " NEWVERSION ".\n\n"
  121.         "It modifies the installed version on your hard disk; "
  122.         "the old files are read from the original CD/Diskette to assure "
  123.         "that these files are really from version " OLDVERSION "." )
  124.   )
  125.  
  126.   (set #AskDestFile
  127.    (cat "Please select the path (including " APPNAME "'s name) where you have "
  128.         "installed your old " APPNAME " version.\n" )
  129.   )
  130.  
  131.   (set #AskDestFileHelp
  132.    (cat "Change to the drawer where you have installed " APPNAME ".\n"
  133.         "The filename is normally correct and thus needn't changed.\n" )
  134.   )
  135.  
  136.   (set #updating (cat "Updating %s ...\n\n"
  137.         "Please be patient.\n" ))
  138.  
  139.   (set #ErrorUpdateMissing (cat "The program that updates the "
  140.         "files (%s) is not available. Please insert the "
  141.         "original TurboCalc4 CDROM (TurboCalcCD:) or diskette #1 "
  142.         "(TurboCalc4_Disk1:) and try again!" ))
  143.  
  144.   (set #ErrorPrgFileMissing (cat APPNAME "'s path is not correct (%s). "
  145.         "The program '%s' couldn't be found there. "
  146.         "Please choose the correct path/file for " APPNAME " in the "
  147.         "following filerequester." ))
  148.  
  149.   (set #ErrorMsg (cat "An error occured during updating:\n%s\n"
  150.             "The file wasn't modified.\n"))
  151.  
  152.   (set #Err1 "Couldn't open  Old-File." )
  153.   (set #Err2 "Couldn't open Dif-File." )
  154.   (set #Err3 "Coudln't open New-File." )
  155.   (set #Err4 "Wrong Old-File (wrong size), UPDATE impossible!" )
  156.   (set #Err5 "Wrong Old-File (CRC incorrect), UPDATE impossible!" )
  157.   (set #Err6 "Wrong Old-File (wrong VER), UPDATE impossible!" )
  158.   (set #Err7 "Wrong Dif-File-Version, UPDATE with this version of UPDATE not possible!" )
  159.   (set #Err8 "Not enough memory!" )
  160.   (set #Err9 "Unknown error: 9" )
  161.   (set #Err10 "UPDATE not found!\n")
  162.   (set #ErrUnkown "Unknown error: %s" )
  163.  
  164.  )
  165. )
  166. ; ---------------------------------------------------------------------
  167. ;
  168. ;   STRINGS (Italian)
  169. ;
  170. ; ---------------------------------------------------------------------
  171. (if (= @language "italiano")
  172.  (
  173.   (set #SourceDir "TurboCalcCD:Italiano/TurboCalc")
  174.   (set #SourceDir_Disk "TurboCalc4_Disk1:TurboCalc")
  175.   (set #UpdateDir "Italiano")
  176.   (set #HelpDir "Aiuto")
  177.   (set #HelpDirOS2 "Aiuto_OS2")
  178.  
  179.   (set #welcome
  180.    (cat "Questo script aggiorna il programma " APPNAME
  181.         " dalla versione " OLDVERSION " alla nuova versione " NEWVERSION ".\n\n"
  182.   ))
  183.   (set #hello
  184.    (cat "Questo script aggiorna il programma " APPNAME
  185.         " dalla versione " OLDVERSION " alla nuova versione " NEWVERSION ".\n\n"
  186.         "Esso modifica la versione installata sul proprio disco rigido; "
  187.         "i vecchi file sono letti dal CD/Dischetto originale per essere "
  188.         "sicuri che essi appartengano davvero alla versione " OLDVERSION "." )
  189.   )
  190.  
  191.   (set #AskDestFile
  192.    (cat "Indicare il percorso (includendo il nome di " APPNAME ") in cui fu "
  193.         "installata la vecchia versione di " APPNAME ".\n" )
  194.   )
  195.  
  196.   (set #AskDestFileHelp
  197.    (cat "Scelta del cassetto in cui fu installato " APPNAME ".\n"
  198.         "Il nome del programma è in genere corretto e non deve essere cambiato.\n" )
  199.   )
  200.  
  201.   (set #updating (cat "Aggiornamento di %s ...\n\n"
  202.         "Attendere prego.\n" ))
  203.  
  204.   (set #ErrorUpdateMissing (cat "Programma per l'aggiornamento dei "
  205.         "file (%s) non disponibile. Inserire il CD-ROM"
  206.         "originale di TurboCalc4 (TurboCalcCD:) o il dischetto #1 "
  207.         "(TurboCalc4_Disk1:) e riprovare!" ))
  208.  
  209.   (set #ErrorPrgFileMissing (cat "Percorso di " APPNAME " errato (%s). "
  210.         "Il programma '%s' non è presente. "
  211.         "Scegliere il percorso/file corretto per " APPNAME " nella "
  212.         "seguente finestra per scelta file." ))
  213.  
  214.   (set #ErrorMsg (cat "Errore occorso durante l'aggiornamento:\n%s\n"
  215.             "Il file non è stato modificato.\n"))
  216.  
  217.   (set #Err1 "Impossibile aprire il file vecchio." )
  218.   (set #Err2 "Impossibile aprire il file dif." )
  219.   (set #Err3 "Impossibile aprire il file nuovo." )
  220.   (set #Err4 "File vecchio errato (dimensione errata), AGGIORNAMENTO impossibile!" )
  221.   (set #Err5 "File vecchio errato (CRC errato), AGGIORNAMENTO impossibile!" )
  222.   (set #Err6 "File vecchio errato (VER errata), AGGIORNAMENTO impossibile!" )
  223.   (set #Err7 "Errata versione file dif, AGGIORNAMENTO impossibile con questa versione!" )
  224.   (set #Err8 "Memoria insufficiente!" )
  225.   (set #Err9 "Errore sconosciuto: 9" )
  226.   (set #Err10 "AGGIORNAMENTO non trovato!\n")
  227.   (set #ErrUnkown "Errore sconosciuto: %s" )
  228.  
  229.  )
  230. )
  231. ; ---------------------------------------------------------------------
  232. ;
  233. ;   STRINGS (French)
  234. ;
  235. ; ---------------------------------------------------------------------
  236. (if (= @language "français")
  237.  (
  238.   (set #SourceDir "TurboCalcCD:Français/TurboCalc")
  239.   (set #SourceDir_Disk "TurboCalc4_Disk1:TurboCalc")
  240.   (set #UpdateDir "Français")
  241.   (set #HelpDir "Aide")
  242.   (set #HelpDirOS2 "Aide_OS2")
  243.  
  244.   (set #welcome
  245.    (cat "Ce script met à jour le programme " APPNAME
  246.         " de la version " OLDVERSION " à la nouvelle version " NEWVERSION ".\n\n"
  247.   ))
  248.   (set #hello
  249.    (cat "Ce script met à jour le programme " APPNAME
  250.         " de la version " OLDVERSION " à la nouvelle version " NEWVERSION ".\n\n"
  251.         "Il modifie la version installée sur votre disque dur. "
  252.         "Les anciens fichiers sont lus depuis le CD ou les disquettes originales "
  253.         "afin de s'assurer qu'ils proviennent bien de la version " OLDVERSION ".\n"
  254. ; Note: the following two lines will only be shown in French!
  255.         "Note : Macros.guide est également mis à jour s'il est trouvé dans le "
  256.         "sous-répertoire « Aide »." )
  257.   )
  258.  
  259.   (set #AskDestFile
  260.    (cat "Veuillez sélectionner le chemin (y compris le nom " APPNAME ") où vous "
  261.         "avez installé l'ancienne version de " APPNAME ".\n" )
  262.   )
  263.  
  264.   (set #AskDestFileHelp
  265.    (cat "Change de répertoire jusqu'à celui où vous avez installé " APPNAME ".\n"
  266.         "Le nom de fichier est théoriquement être correct et ne devrait donc pas être changé.\n" )
  267.   )
  268.  
  269.   (set #updating (cat "Mise à jour de %s ...\n\n"
  270.         "Veuillez patienter.\n" ))
  271.  
  272.   (set #ErrorUpdateMissing (cat "Le programme qui met à jour les "
  273.         "fichiers (%s) n'est pas disponible. Veuillez insérer le CDROM "
  274.         "original de TurboCalc 4 (TurboCalcCD:) ou la disquette #1 "
  275.         "(TurboCalc4_Disk1:) et réessayez !" ))
  276.  
  277.   (set #ErrorPrgFileMissing (cat "Le chemin de " APPNAME " est incorrect (%s). "
  278.         "Le programme '%s' n'a pas pu y être trouvé. "
  279.         "Veuillez choisir le chemin ou le fichier correct pour " APPNAME " dans "
  280.         "le selecteur de fichiers qui suit." ))
  281.  
  282.   (set #ErrorMsg (cat "Une erreur est survenue pendant la mise à jour de :\n%s\n"
  283.             "Le fichier n'est pas modifié.\n"))
  284.  
  285.   (set #Err1 "Impossible d'ouvrir l'ancien fichier." )
  286.   (set #Err2 "Impossible d'ouvrir le fichier de différences." )
  287.   (set #Err3 "Impossible d'ouvrir le nouveau fichier." )
  288.   (set #Err4 "Ancien fichier erroné (taille incorrecte), mise à jour impossible !" )
  289.   (set #Err5 "Ancien fichier erroné (somme de contrôle incorrecte), mise à jour impossible !" )
  290.   (set #Err6 "Ancien fichier erroné (version incorrecte), mise à jour impossible !" )
  291.   (set #Err7 "Version de fichier de différences erronée, mise à jour impossible vers cette version !" )
  292.   (set #Err8 "Mémoire insuffisante !" )
  293.   (set #Err9 "Erreur inconnue : 9" )
  294.   (set #Err10 "Mise à jour non trouvée !\n")
  295.   (set #ErrUnkown "Erreur inconnue : %s" )
  296.  
  297.  )
  298. )
  299.  
  300. ;------------------------------------------------------------------------
  301. (procedure P_UPDATE #up_dpath #up_spath #up_upath #up_file #up_msg
  302.  (if (exists (tackon #up_dpath #up_file) (noreq))
  303.   (
  304.     (set #up_msg #up_file)
  305.     (working (#updating #up_msg))
  306.     ; run the update utility
  307.     (set res (run (cat #updateprg " \"" (tackon #up_spath #up_file) "\" \"" (tackon #up_upath #up_file) ".dif\" \"" (tackon #up_dpath #up_file) "\"")))
  308.  
  309.     ; has an error occured?
  310.     (if (= res 0)
  311.         (set res 0)
  312.         (message (#ErrorMsg
  313.                (if (<= res 8)
  314.                   (select res #Err1 #Err2 #Err3 #Err4 #Err5 #Err6 #Err7 #Err8)
  315.                   ( if (= res 10) (#Err10)
  316.                                   (#ErrUnkown res)
  317.                   )
  318.                ))
  319.        ) ; message
  320.     ) ; if
  321.   )
  322.  ) ; if exists
  323. ) ; UPDATE
  324.  
  325. ;------------------------------------------------------------------------
  326. ; Where is APPNAME installed? Perhaps we should have added an
  327. ; assign to user-startup when installing APPNAME - but why add
  328. ; an assign if we only need it for this purpose.
  329. ; So we simply look at some default locations - and ask the user
  330. ; otherwise
  331. ; APPNAME (including path if found) is returned in PrgFile, then
  332. (procedure P_FINDAPP
  333.     (set PrgFile APPNAME)
  334.     (set #n 0)
  335.     (while (set #thisfile (select #n "TurboCalc:" "Work:TurboCalc" "SYS:Work/TurboCalc" "SYS:TurboCalc" "dh0:Work/TurboCalc" "dh0:TurboCalc" "dh1:Work/TurboCalc" "dh1:TurboCalc" ""))
  336.       (
  337.         (set #n (+ #n 1))
  338.         (if (= PrgFile APPNAME) ; i.e. not yet found
  339.           (if (= 1 (exists (tackon #thisfile APPNAME) (noreq)))
  340.             (set PrgFile (tackon #thisfile APPNAME))
  341.           ) ; if
  342.         ) ; if
  343.       )
  344.     ) ; while
  345. )
  346. ; ---------------------------------------------------------------------
  347. ;
  348. ;   INSTALLATION SCRIPT - BEGIN
  349. ;
  350. ; ---------------------------------------------------------------------
  351.  
  352. ; *** say hello to the user
  353. (welcome #welcome)
  354. (message #hello)
  355.  
  356. ; *** check that 'Update' is available (either CD or Disk 1)
  357. (while (AND
  358.         (<> 1 (exists #updateprg (noreq)))
  359.         (<> 1 (exists #updateprg_disk (noreq)))
  360.        )
  361.   (
  362.     (if (= 0 @user-level) (user 1))
  363.     (message (#ErrorUpdateMissing #updateprg))
  364.   )
  365. )
  366.  
  367. (if (= 1 (exists #updateprg_disk (noreq)))
  368.  (
  369.     (set #DiskVersion 1)
  370.     (set #updateprg #updateprg_disk)
  371.     (set #SourceDir #SourceDir_Disk)
  372.  )
  373. )
  374.  
  375.  
  376. (complete 5)
  377.  
  378. ; *** ask user where he has installed the old version of the app.
  379. (P_FINDAPP)
  380. (set PrgFile
  381.  (askfile
  382.   (prompt #AskDestFile )
  383.   (help #AskDestFileHelp )
  384.   (default PrgFile)
  385.  )
  386. )
  387. ; *** check that Prgfile really exists, else ask again
  388. (while (<> 1 (exists PrgFile))
  389.   (
  390.     (if (= 0 @user-level) (user 1))
  391.     (message (#ErrorPrgFileMissing (pathonly PrgFile) PrgFile))
  392.     (set PrgFile
  393.      (askfile
  394.       (prompt #AskDestFile)
  395.       (help #AskDestFileHelp)
  396.       (default PrgFile)
  397.      )
  398.     )
  399.   )
  400. )
  401.  
  402. ; ***
  403. (set @default-dest (pathonly PrgFile))
  404. (set #defaultdata (pathonly @icon))
  405. (set @execute-dir #defaultdata)
  406.  
  407. ; *** ok, now start updating...
  408. ; update TurboCalc
  409. (complete 10)
  410. (P_UPDATE @default-dest #SourceDir #defaultdata "TurboCalc")
  411.  
  412. ; update Macros.guide (French version only)
  413. (complete 50)
  414. (if (= @language "français")
  415.  (if (exists (tackon (tackon @default-dest #HelpDir) "Macros.guide") (noreq))
  416.   (
  417.     (set #filesize (getsize (tackon (tackon @default-dest #HelpDir) "Macros.guide")))
  418.     (if (= 265229 #filesize)
  419.       (P_UPDATE (tackon @default-dest #HelpDir)
  420.                 (if #DiskVersion
  421.                    (tackon @default-dest #HelpDir)
  422.                    (tackon #SourceDir #HelpDirOS2)
  423.                 )
  424.                 (tackon #defaultdata #HelpDirOS2)
  425.                 "Macros.guide" )
  426.     ) ;if filesize
  427.     (if (= 272845 #filesize)
  428.       (P_UPDATE (tackon @default-dest #HelpDir)
  429.                 (if #DiskVersion
  430.                    (tackon @default-dest #HelpDir)
  431.                    (tackon #SourceDir #HelpDirO)
  432.                 )
  433.                 (tackon #defaultdata #HelpDir)
  434.                 "Macros.guide" )
  435.     ) ;if filesize
  436.   )
  437.  ) ; if exists
  438. ) ; if (language)
  439.  
  440. ; *** update common files (e.g. Catalogs)
  441. (set #defaultdata (tackon #defaultdata "/Common"))
  442. (set @execute-dir #defaultdata)
  443.  
  444. (complete 70)
  445. ;(P_UPDATE @default-dest #SourceDir #defaultdata "Catalogs/deutsch/TurboCalc.catalog")
  446.  
  447. ; *** copy any additional files
  448. ; currently not needed
  449.  
  450. ; *** fine, all done
  451. (complete 100)
  452.  
  453. ; ---------------------------------------------------------------------
  454. ;
  455. ;   INSTALLATION SCRIPT - END
  456. ;
  457. ; ---------------------------------------------------------------------
  458.